package com.yc.boot.train.api;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yc.boot.common.model.response.Outcome;
import com.yc.boot.train.business.NoticeManageBussiness;
import com.yc.boot.train.entity.Notice;
import com.yc.boot.train.model.find.GradeManage;
import com.yc.boot.train.model.find.IPageGradeManage;
import com.yc.boot.train.model.find.IPageNotice;
import com.yc.boot.train.model.find.NoticeMessage;
import com.yc.boot.train.model.save.SaveGradeManage;
import com.yc.boot.train.model.save.SaveNoticeManage;
import com.yc.boot.train.model.update.UpdataGradeManage;
import com.yc.boot.train.model.update.UpdateNotice;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;
import javax.validation.constraints.Size;
import java.util.List;

/**
 * Create with IntelliT IDEA
 *
 * @Author: zhengmingzhe
 * @Date: 2022/01/11/14:11
 * @Description:
 */
@RestController
@Api(tags = "通知公告管理页面接口接口")
@RequestMapping("/notice")
public class NoticeManageApi {
    @Resource
    private NoticeManageBussiness noticeManageBussiness;

    @GetMapping("/queryNoticeMessage")
    @ApiOperation("获取通知公告管理页面信息")
    public Outcome<IPage<NoticeMessage>> queryNoticeMessage(IPageNotice page){
        return Outcome.success(noticeManageBussiness.queryNoticeMessage(page));
    }

    @GetMapping("/QueryNoticeById")
    @ApiOperation("根据id获取公告信息")
    public Outcome<NoticeMessage> QueryNoticeById(NoticeMessage id){
        return Outcome.success(noticeManageBussiness.QueryNoticeById(id));
    }

    @PostMapping("/saveNoticeManage")
    @ApiOperation("添加公告信息管理项")
    public Outcome saveNoticeManage(@RequestBody @Valid SaveNoticeManage param){
        return noticeManageBussiness.saveNoticeManage(param);
    }

    @PutMapping("/updateNotice")
    @ApiOperation("修改分数管理项")
    public Outcome updateNoticeManage(@RequestBody @Valid UpdateNotice param){
        return noticeManageBussiness.updateNoticeManage(param);
    }

    @DeleteMapping("/delete")
    @ApiOperation("删除")
    public Outcome delete(@RequestBody @Valid @Size(min = 1) List<Long> id) {
        return Outcome.status(noticeManageBussiness.delete(id));
    }
}
